﻿using MoviesWeb.DAL;
using MoviesWeb.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MoviesWeb.BLL
{
    public class ManagerBLL
    {
        static ManagerDAL managerdal = new ManagerDAL();
        public static bool Login(string account, string password)
        {
            return managerdal.Login(account, MD5(password));
        }
        public static bool Changepwd(string account, string oldpwd, string newpwd,int id)
        {
            return managerdal.Changepwd(account, MD5(oldpwd), MD5(newpwd), id);
        }
        public static  bool ManagerIsExist(string account)
        {
            return managerdal.ManagerIsExist(account);
        }
        public static Manager GetManager(string account)
        {
            return managerdal.GetManager(account);
        }
        public static List<Manager> GetManagerList()
        {
            return managerdal.GetManagerList();
        }
        public static bool ChangeLostLoginTime(string account)
        {
            return managerdal.ChangeLostLoginTime(account);
        }
        public static bool Add(Manager manager)
        {
            manager.Mn_password = MD5(manager.Mn_password);
           return  managerdal.Add(manager);
        }
        public static bool Remove(int id)
        {
           return managerdal.Remove(id);
        }
        public static string MD5(string password)
        {
          return  System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
        }
    }
}
